package itheima.com.SocketTCPImg;

import java.io.*;
import java.net.InetAddress;
import java.net.Socket;
import java.net.UnknownHostException;

public class clienmt {

    public static void main(String[] args) throws Exception {

        Socket socket = new Socket(InetAddress.getLocalHost(),8888);
        System.out.println("客户端接收");

        String filePath = "D:\\一条小团团\\xxx.jpg";
        BufferedInputStream bufferedInputStream = new BufferedInputStream(new FileInputStream(filePath));

        byte[] bytes = StreamUtils.streamToByteArray(bufferedInputStream);

        BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(socket.getOutputStream());
        bufferedOutputStream.write(bytes);
        bufferedInputStream.close();
        socket.shutdownOutput();

//        socket.close();
        bufferedOutputStream.close();
        socket.close();
    }

}
